/*
 * Created on 26/02/2004
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package org.potiorb.orb.marshal;

import org.potiorb.orb.giop.GIOPMessageReply;
import org.potiorb.orb.giop.GIOPMessageRequest;
import org.potiorb.orb.giop.MessageType;
import org.potiorb.orb.portable.ObjectRef;


public class Marshaler {
	private CDREncoder m_Encoder;
	private TypeCodeInterpreter m_TCInterpreter;

	public GIOPMessageRequest MarshalInvocationRequest(ObjectRef pObjectRef,
							  CallData calldata,
							  Any data)
	{

		GIOPMessageRequest msg = new GIOPMessageRequest();
		msg.setM_MessageType( new MessageType(MessageType.REQUEST));
		//msg.setMessageSize()
		byte[] context = {0x00,0x00,0x00,0x00};
		msg.setService_context(context);
		msg.setRequestID(1);
		msg.setResponse_expected(true);
		String key = pObjectRef.getKeyobject();
		msg.setObject_key(key);
		msg.setOperation(calldata.getMethodName());
		msg.setRequest_body(data.extract_string().getBytes());

		return msg;
	};
	public void UnmarshalInvocationReply(GIOPMessageReply msg)
	{

	}
        public ObjectRef getObjectRef(GIOPMessageRequest msg)
        {
          ObjectRef _ref = new ObjectRef();
          _ref.setKeyobject(msg.getObject_key());
          return _ref;
        }
	
        
    public CDREncoder getM_Encoder() {
			return m_Encoder;
    }
	
    public TypeCodeInterpreter getM_TCInterpreter() {
			return m_TCInterpreter;
	}
   
        
        
}
